package com.aysf.drafter.service.impl;

import com.aysf.drafter.entity.BedLayout;
import com.aysf.drafter.entity.Result;
import com.aysf.drafter.mapper.BedLayoutMapper;
import com.aysf.drafter.service.IBedLayoutService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author MaoZz
 * @since 2024-12-21 17:19:15
 */
@Service
public class BedLayoutServiceImpl extends ServiceImpl<BedLayoutMapper, BedLayout> implements IBedLayoutService {

    @Autowired
    private BedLayoutMapper bedLayoutMapper;

    @Override
    public Result get() {
        QueryWrapper<BedLayout> wrapper = new QueryWrapper<BedLayout>()
                .like("bed_status", "空床");
        List<BedLayout> bedLayouts = bedLayoutMapper.selectList(wrapper);
        if (bedLayouts != null && bedLayouts.size() > 0) {
            return new Result("success", bedLayouts);
        }
        else return new Result("error");

    }
}
